From: Jasper St. Pierre Date: Mon, 28 Feb 2011 18:15:02 +0000 (-0500) Subject: telepathyClient: Add alias change notifiers X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8674 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8c40c2086aac9d252c51150a9ac5f4760ba352dc;p=gnome-shell.git telepathyClient: Add alias change notifiers Update the Source title when an contact's alias changes, and also also add a minor meta message like the current timestamps. Updating the alias of a 'presenced' contact will overwrite the current title, and it will also not update the summary item title right now due to limitations of the message tray. https://bugzilla.gnome.org/show_bug.cgi?id=642793 --- diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js index 7bfc7ace1..ab90579a3 100644 --- a/js/ui/telepathyClient.js +++ b/js/ui/telepathyClient.js @@ -116,7 +116,7 @@ Source.prototype = { __proto__: MessageTray.Source.prototype, _init: function(account, conn, channel, contact) { - MessageTray.Source.prototype._init.call(this, channel.get_identifier()); + MessageTray.Source.prototype._init.call(this, contact.get_alias()); this.isChat = true; @@ -127,8 +127,6 @@ Source.prototype = { this._channel = channel; this._closedId = this._channel.connect('invalidated', Lang.bind(this, this._channelClosed)); - this._updateAlias(); - this._notification = new Notification(this); this._notification.setUrgency(MessageTray.Urgency.HIGH); @@ -151,7 +149,10 @@ Source.prototype = { }, _updateAlias: function() { + let oldAlias = this.title; this.title = this._contact.get_alias(); + this._notification.appendAliasChange(oldAlias, this.title); + this.pushNotification(this._notification); }, createNotificationIcon: function() { @@ -373,6 +374,19 @@ Notification.prototype = { this._history.unshift({ actor: label, time: (Date.now() / 1000), realMessage: false}); }, + appendAliasChange: function(oldAlias, newAlias) { + oldAlias = GLib.markup_escape_text(oldAlias, -1); + newAlias = GLib.markup_escape_text(newAlias, -1); + + /* Translators: this is the other person changing their old IM name to their new + IM name. */ + let message = '' + _("%s is now known as %s").format(oldAlias, newAlias) + ''; + let label = this.addBody(message, true); + label.add_style_class_name('chat-meta-message'); + this._history.unshift({ actor: label, time: (Date.now() / 1000), realMessage: false }); + this.update(newAlias, null, { customContent: true }); + }, + _onEntryActivated: function() { let text = this._responseEntry.get_text(); if (text == '')